<?php
//=======================================
//###################################
// Kayako Web Solutions
//
// Source Copyright 2001-2004 Kayako Web Solutions
// Unauthorized reproduction is not allowed
// License Number: $%LICENSE%$
// $Author: vshoor $ ($Date: 2007/07/10 08:57:50 $)
// $RCSfile: client_modernbillv5.php,v $ : $Revision: 1.1 $ 
//~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
//
//###################################
//=======================================


if (!defined("INSWIFT")) {
	trigger_error("Unable to process $PHP_SELF", E_USER_ERROR);
}

require_once ("./modules/news/functions_clientnews.php");
require_once ("./includes/functions_users.php");
require_once ("./includes/functions_comments.php");
$template->loadLanguageSection("newsclient");

		/*
		Array
		(
			[0] => Array
				(
					[newsGroupID] => 1
					[newsGroupName] => Test
					[newsGroupDescription] => test
					[newsGroupActive] => 1
					[newsGroupOrder] => 
					[articles] => Array
						(
							[0] => Array
								(
									[newsID] => 1
									[adminID] => 1
									[newsSubject] => test news
									[newsShortBody] => this is some short body
									[newsBody] => wee
		woo
									[newsDateCreated] => 
									[priorityID] => 0
									[newsActive] => 1
									[newsGroupID] => 1
									[newsGroupName] => Test
									[newsGroupDescription] => test
									[newsGroupActive] => 1
									[newsGroupOrder] => 
								)

						)

				)

		)
		*/

if (MBAREA == "dashboard")
{
	// ======= PERMISSION CHECK =======
	if ($_SWIFT["user"]["permissions"]["perm_canviewnews"] == "0" || $_SWIFT["settings"]["nw_enableclient"] == "0")
	{
		$_SWIFT["helpdeskNews"] = array();
	} else {
		$_SWIFT["helpdeskNews"][0]["newsGroupID"] = 1;
		$_SWIFT["helpdeskNews"][0]["newsGroupName"] = $_SWIFT["language"]["mbnewscat"];
		$_SWIFT["helpdeskNews"][0]["newsGroupDescription"] = $_SWIFT["language"]["mbnewscatdesc"];
		$_SWIFT["helpdeskNews"][0]["newsGroupActive"] = 1;
		$_SWIFT["helpdeskNews"][0]["newsGroupOrder"] = "";
		$dbCore->query("SELECT * FROM `". TABLE_PREFIX ."news` AS news LEFT JOIN `". TABLE_PREFIX ."newsdata` AS newsdata ON (news.newsid = newsdata.newsid) WHERE news.tgroupid = '". intval($_SWIFT["tgroup"]["tgroupid"]) ."' AND news.newstype = '". SWIFTPUBLIC ."' AND (news.expiry > '". DATENOW ."' OR news.expiry = '0') ORDER BY news.newsid DESC;");
		while ($dbCore->nextRecord())
		{
			$_SWIFT["helpdeskNews"][0]["articles"][] = array("newsID" => $dbCore->Record["newsid"], "adminID" => $dbCore->Record["staffid"], "newsSubject" => htmlspecialchars($dbCore->Record["subject"]), "newsShortBody" => htmlspecialchars($dbCore->Record["description"]), "newsBody" => $dbCore->Record["contents"], "newsDateCreated" => $dbCore->Record["dateline"], "priorityID" => 0, "newsActive" => 1, "newsGroupName" => $_SWIFT["language"]["mbnewscat"], "newsGroupDescription" => $_SWIFT["language"]["mbnewscatdesc"], "newsGroupActive" => 1, "newsGroupOrder" => "");
		}
	}
}

?>